<?php
/**
 *      [迷你云] (C)2009-2012 南京恒为网络科技.
 *   软件仅供研究与学习使用，如需商用，请访问www.miniyun.cn获得授权
 * 
 */
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="pragma" content="no-cache" />
<title>搜索文件</title>
<link href="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/css/common.css?v=<?php echo(Yii::app()->params['app']['version'])?>" rel="stylesheet" type="text/css" />
<link href="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/css/page.css?v=<?php echo(Yii::app()->params['app']['version'])?>" rel="stylesheet" type="text/css" />
<script type="text/javascript">document.domain = window.location.host;</script>
<script type="text/javascript" src="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/js/jquery.js?v=<?php echo(Yii::app()->params['app']['version'])?>"></script>
<script type="text/javascript" src="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/js/util.js?v=<?php echo(Yii::app()->params['app']['version'])?>"></script>
</head>

<body>

<div class="top-handle">
    <div class="con" id="js_page_op_menu">
            <div class="btn-wrap">
<!--                <a href="javascript:;" class="btn btn-disabled" menu="shareto">分享</a>-->
                <a href="javascript:;" class="btn btn-disabled" menu="download">下载</a>
                <a href="javascript:;" class="btn btn-disabled" menu="delete">删除</a>
            </div>
                
        
        
        <div class="search-box">
            <form id="js_search_file_form">
            <label for="js_search_input">搜索文件</label>
            <input type="text" class="text" name="search_value" autocomplete="off" value="<?php echo $searchValue?>" id="js_search_input">
            <button type="submit"><i>搜索</i></button>
            </form>
            <script type="text/javascript" src="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/js/search_file.js?v=<?php echo(Yii::app()->params['app']['version'])?>"></script>
        </div>
    </div>
</div>
<script type="text/javascript">
    try{
        if(parent){
            parent.window.PageCTL.MarkURL(window.location.href);
        }
    }catch(e){}
</script>
<div class="page-main">
    <div class="col-main" id="js_cantain_box">
        <div class="path-box" rel="page_local"></div>
            
        <?php if ($count > 0){?>
         <div class="list-container" id="js_data_list_outer">
            <div style="min-height:100%;_height:100%;cursor:default" id="js_data_list">
            <dl class="file-list" rel="list" id="js_data_list_inner">

                <dt>
                <ul>
                    <li class="file-check">
                        <input type="checkbox" check="all" />
                    </li>
                    <li class="file-name"><a href="javascript:;">文件名</a></li>
                    <li class="file-time"><a href="javascript:;">上传时间</a></li>
                    <li class="file-size"><a href="javascript:;">大小</a></li>

                    <li class="file-loca" style="width:200px"><a href="javascript:;">位置</a></li>
                </ul>
                </dt>
                
                <?php foreach($list as $file){?>
                <dd rel="item" file_type="1" file_size="<?php echo $file['byte']?>" user_ptime="<?php echo $file['file_update_time']?>" is_share="0" pick_expire="" file_id="<?php echo $file['id']?>" area_id="<?php echo $file["type"]?>" p_id="<?php echo $file['parent_file_id']?>" pick_code="<?php echo $file['id']?>">
                    <ul>
                        <li class="file-check">
                            <input type="checkbox" value="" filename="<?php echo $file['file_name']?>" filetype="" pickcode="cl1scgrp" />
                            <textarea style="display:none;" field="desc"></textarea>
                        </li>
                        <li class="file-name">
                         <a href="javascript:;" target="_blank" onclick="return false;">
                         <i rel="select" class="file-type tp-<?php echo $file['ext']?>"></i>
                                <span title="<?php echo $file['file_name']?>" field="file_name">
                                <?php $fileName = $file['file_name'];
                                   $replaceName = htmlspecialchars("<span style='color: #FF0000; background-color: #FFFF00;'>".$searchValue."</span>");
                                   $showName = htmlspecialchars_decode(str_ireplace($searchValue,$replaceName,$fileName));
                                   echo $showName;
                                ?>
                            </a>
                        </li>
                        <li class="file-time"><span><?php echo $file['created_at']?></span></li>
                        <li class="file-size"><i><?php echo $file['file_size']?></i></li>
                        <li class="file-loca"><a href="javascript:;" btn="goto_dir" aid="1" cid="<?php echo $file['parent_file_id']?>" title="<?php echo $file['file_path']?>"><?php echo $file['file_path']?></a></li>
                    </ul>
                </dd>
             <?php }?>

            </dl>
            </div>
        </div>
        
            <div class="pages"><div class="con">
            <?php if ($pageSize > 1){ ?>
            <?php if ($currentPage ==1){ ?>
                <span class='btn btn-prev'>上一页</span>
            <?php }else{?>
                <a href='<?php echo(Yii::app()->params['app']['host'])?>/index.php?r=list/index&ct=file&ac=search&aid=<?php echo $aid?>&search_value=<?php echo $searchValue?>&date=0&s=<?php echo ($currentPage-2)*$limit?>' class='btn btn-prev'>上一页</a>
            <?php }?>
             <?php   for ($i=1; $i <= $pageSize; $i++){
                    $css = "";
                    if ($i == $currentPage){
                        $css = "class='focus'";
                    }
             ?>
             <a href='<?php echo(Yii::app()->params['app']['host'])?>/index.php?r=list/index&ct=file&ac=search&aid=<?php echo $aid?>&search_value=<?php echo $searchValue?>&date=0&s=<?php echo ($i-1)*$limit?>' <?php echo $css?>><?php echo $i?></a> 
            <?php } ?>
            <?php if ($pageSize == $currentPage) {?>
                <span class="btn btn-next">下一页</span>
            <?php }else{ ?>
                <a href='<?php echo(Yii::app()->params['app']['host'])?>/index.php?r=list/index&ct=file&ac=search&aid=<?php echo $aid?>&search_value=<?php echo $searchValue?>&date=0&s=<?php echo ($currentPage)*$limit?>' class='btn btn-next'>下一页</a>
            <?php }} ?>
            </div></div>
        
       <?php }else{?>   <!-- 搜索到的个数为0  -->
            <div class="page-info">
                <h3><i class="i-hint ico-war"></i>抱歉，<?php echo(Yii::app()->params['app']['name'])?>没有<font color="orange">“<?php echo $searchValue?>”</font>的搜索结果</h3>
            </div>
       <?php }?>
    </div>
    <div class="col-sub" id="js_right_side">
        <div class="file-info"></div>
    </div>
</div>



<script type="text/javascript">
    var IsTempLoad = true;
    var dataSource = {aid: -3, cid: 0};
    var NoRightSide = false;
    var downURI = "<?php echo(Yii::app()->params['app']['host'])?>";
    var interface = {
        GetHtml: function(arr){
            return "";
        },
        Privacy: function(setting, item){
            if(setting.answer){
                item.attr("has_pass","1");
                item.attr("file_pwd", setting.answer);
                item.find("[field='ext3']").val(setting.question);
                if(!item.find("[rel='has_pass']").length){
                    var html = '<b rel="has_pass">[已加密]</b>';
                    item.find(".file-name").append(html);
                }
                window["interface"].Share(item);
            }
            else{
                item.attr("has_pass", "");
                item.removeAttr("file_pwd");
                item.find("[field='ext3']").val("");
                item.find("[rel='has_pass']").empty().remove();
            }
        },
        AllowCollect: function(is_collect, item){
            item.attr("is_collect", is_collect);
        },
        Share: function(item){
            item.removeAttr("load_data");
            item.attr("is_share", "1");
            item.find(".file-type").html('<b class="shared"></b>');
            item.find(".file-state").html('<em>分享</em> <a href="javascript:;" class="link-icon" onclick="interface.Copy(this);"><span class="con"><i class="icon ico-copylink"></i>复制分享地址</span></a>');
            item.attr("pick_expire", "31天");
        },
        CancelShare: function(item){
            item.attr("is_share", "0");
            item.find(".file-type").html('');
            item.find(".file-state").html('私有');
        },
        Copy:function(ele){
            var line = $(ele).parents('[rel="item"]');
            var url = downURI + ((line.attr("file_type") == "1")? "/file/" : "/folder/" ) + line.attr("pick_code");
            Util.Copy(url);
        }
    }
</script>
<script type="text/javascript" src="<?php echo(Yii::app()->params['app']['host'])?>/statics/web/js/list.js?v=20111123"></script>
<script type="text/javascript">
//选中文件委托
FileCheckHandler = function(arr, eX, eY){
    TopMenu.CheckMenu(arr, eX, eY);
}
FileCheckHandler(false);

PageCommmon.ResetFileName();

</script>
<!--<script type="text/javascript">-->
<!--    $(document).ready(function(){-->
<!--        $.getScript('http://q.miniyun.com/api/search.php?jsreturn=js_search_g_count&keywords=' + encodeURIComponent('a'), function(){-->
<!--            var r = window['js_search_g_count'];-->
<!--            if(r && r.data && r.data.count){-->
<!--                if(!Number(r.data.count)){return;}-->
<!--                var dom = $(' <span style="margin-left:20px;"><i class="i-hint ico-inf-s"></i> 我们在miniyun圈子找到相关的附件 <b>'+r.data.count+'</b> 个, <a href="javascript:;">您是否要看看？</a></span>');-->
<!--                $("#js_cantain_box").find("[rel='page_local']").append(dom);-->
<!--                dom.find("a").bind("click", function(){-->
<!--                    parent.window.Main.URL_CTL.G("sf/" + encodeURIComponent('a'));-->
<!--                    return false;-->
<!--                })-->
<!--                //parent.window.Main.URL_CTL.G("sf/" + encodeURIComponent($.trim($(searchValue).val())));-->
<!--            }-->
<!--        });-->
<!--    })-->
<!--</script>-->
</body>
</html>
